package org.x4444.transd;

import java.io.IOException;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
import org.x4444.trans.TransUtils;

public class TransdMapper extends Mapper<LongWritable, Text, Text, Text> {

    Text k = new Text();

    @Override
    protected void map(LongWritable key, Text value, org.apache.hadoop.mapreduce.Mapper<LongWritable, Text, Text, Text>.Context context) throws IOException,
            InterruptedException {

        String line = value.toString();

        String eventDt = TransUtils.getEventDt(line);
        
        if (eventDt.length() >= 10) {
            return;
        }

        k.set(eventDt);

        context.write(k, value);
    }
}
